Skip to content

bugfix(audio): Fix particle cannon being inaudible after saveload#2302

Merged
xezon merged 5 commits into
TheSuperHackers:mainfrom
stephanmeesters:bigfix-particlecannon-audio
Feb 28, 2026
Merged

bugfix(audio): Fix particle cannon being inaudible after saveload#2302
xezon merged 5 commits into
TheSuperHackers:mainfrom
stephanmeesters:bigfix-particlecannon-audio

Conversation

@stephanmeesters

@stephanmeesters stephanmeesters commented Feb 13, 2026

Copy link
Copy Markdown

Fixes issue where sound from the particle cannon is not audible after saveload.

A savegame can be made during any of combinations of STATUS_ and LASERSTATUS_ below. Sounds are triggered only during state change, so when loading a savegame any of the sounds in the Active column need to be added.

Tested with a savegame for each STATUS_.

Repeating sequence of the particle cannon

STATUS_ LASERSTATUS_ Add sound Clear sound Active sound
PACKING (1) NONE none none none
CHARGING NONE powerupSound unpackToReadySound
firingToIdleSound
annihilationSound
powerupSound
PREPARING NONE unpackToReadySound firingToIdleSound
annihilationSound
powerupSound
unpackToReadySound
ALMOST_READY NONE none none powerupSound
unpackToReadySound
READY_TO_FIRE NONE none powerupSound
firingToIdleSound
annihilationSound
unpackToReadySound
PREFIRE NONE none none unpackToReadySound
FIRING NONE
BORN
firingToIdleSound
annihilationSound¹
powerupSound
unpackToReadySound
firingToIdleSound
annihilationSound
POSTFIRE BORN none none firingToIdleSound
annihilationSound
PACKING (2) DECAYING
DEAD
none annihilationSound² firingToIdleSound
annihilationSound
IDLE NONE none powerupSound
unpackToReadySound
firingToIdleSound
annihilationSound
none

¹ Sound added at LASERSTATUS_BORN
² Sound cleared at LASERSTATUS_DEAD

PACKING appears twice for some reason.

Status meanings

  • PACKING (1): Particle cannon is inactive and fully reset. Idle state.
  • CHARGING: Early pre-ready phase; charging loop plays.
  • PREPARING: Antenna/deploy preparation phase.
  • ALMOST_READY: Near-ready phase before final ready state.
  • READY_TO_FIRE: Weapon is available and waiting for fire command.
  • PREFIRE: Transitional pre-shot state (defined and checked, typically brief/rare in this flow).
  • FIRING: Main active attack phase while beam is operating.
  • POSTFIRE: Attack is decaying after firing window ends.
  • PACKING (2): Pack-up phase after attack/ready path.
  • IDLE: Another form of idle, used to reset audio, lasts very short.

Laser status meanings

  • NONE: No orbital beam lifecycle started yet for current cycle.
  • BORN: Orbit-to-target beam was created and is in active phase.
  • DECAYING: Beam is in decay/shutdown window.
  • DEAD: Beam lifecycle is finished (end state before reset to NONE on next cycle setup).

Sound meanings

  • powerupSound: Charge, at particle cannon.
  • unpackToReadySound: Prep, at particle cannon.
  • firingToIdleSound: Firing/packing, at particle cannon.
  • annihilationSound: Beam-impact, at origin beam.

Todo

  • Replicate to Generals

@greptile-apps

greptile-apps Bot commented Feb 13, 2026

Copy link
Copy Markdown

Greptile Summary

Fixes particle cannon sounds not playing after saveload by restoring audio events in loadPostProcess() based on the current state. The implementation correctly maps each combination of STATUS_ and LASERSTATUS_ to their active sounds as documented in the PR's state table.

Changes:

  • Restores powerupSound for charging states (CHARGING, PREPARING, ALMOST_READY)
  • Restores unpackToReadySound for preparation and ready states (PREPARING, ALMOST_READY, READY_TO_FIRE, PREFIRE)
  • Restores firingToIdleSound and annihilationSound for firing/post-fire states (FIRING, POSTFIRE, PACKING with decaying/dead laser)
  • Correctly handles beam existence check before adding annihilationSound
  • Applied identically to both Generals and Zero Hour versions

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • Logic correctly implements the documented state table, follows existing code patterns, includes proper null checks, and has been tested with savegames for each status. Both game versions updated consistently.
  • No files require special attention

Important Files Changed

Filename Overview
Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp Added sound restoration logic in loadPostProcess() to fix inaudible particle cannon after saveload, correctly mapping states to active sounds per the documented state table
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp Added sound restoration logic in loadPostProcess() to fix inaudible particle cannon after saveload, correctly mapping states to active sounds per the documented state table

Last reviewed commit: 63f3646

@xezon xezon added Bug Something is not working right, typically is user facing Audio Is audio related Minor Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour Saveload Is Saveload/Xfer related labels Feb 14, 2026

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

@xezon xezon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks ok. I did not test and did not verify all these conditions are correct. Not important, because it is a temporary fix. Needs to be replicated to Generals.

@xezon xezon merged commit 8cce6f6 into TheSuperHackers:main Feb 28, 2026
25 checks passed
Okladnoj pushed a commit to Okladnoj/GeneralsGameCode that referenced this pull request Mar 1, 2026
@stephanmeesters stephanmeesters deleted the bigfix-particlecannon-audio branch April 13, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Audio Is audio related Bug Something is not working right, typically is user facing Gen Relates to Generals Minor Severity: Minor < Major < Critical < Blocker Saveload Is Saveload/Xfer related ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants